Adds thread-safety for trees that are accessed on only one thread#100
Adds thread-safety for trees that are accessed on only one thread#100PTNobel wants to merge 1 commit into
Conversation
|
This is I think the only PR needed on the base engine to make the python library support free-threading. |
|
Honestly, I think we should move to C17 or C23. I don't think we gain anything from the old standards |
|
Can you explain what you are trying to do? |
|
I'm trying to add free threading support to CVXPY. This means we need to have a thread safety story for all our dependencies. Looking through this library, it seemed to have only one dependency on shared state, so I was trying to eliminate that so we could have a clear thread safety story here. I will then add free-threading support in the Python bindings. |
|
|
f5549f4 to
7f8e515
Compare
|
I think my expectation at this point is "if a expression tree is only ever accessed from one thread, this library is thread-safe" would be the story I'm after here. We'll have to do some locking at the python level; but I think this would be a good start to get rid of the obvious issues. |
Best I can tell from going through the code, the only state that is shared across trees is the alloc variables; so this makes them thread locals.
To access thread locals, I bump the C version to C11. Every platform CVXPY supports supports C11, so I figured this would be not an issue. LMK if I am worng.